package day17.zhiyou100;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Arrays;
import java.util.Scanner;

// 文件字符输入流
public class Demo02_FileReader {

    //
    public static void read() throws Exception {
        File file = new File("D:\\aa\\bb\\ww.txt");
        // 创建一个文件字符输入流对象
        FileReader fr = new FileReader(file);
        // read()  读取到单个字符值--->int整数值
        int read = fr.read();
        System.out.println((char) read);//

        // 读取多个字符值
        // read(char[] chars)
        char[] chars = new char[1024];
        int read2 = fr.read(chars);
        System.out.println(Arrays.toString(chars));//
        System.out.println(read2);
        // 成行读取

    }

    public static void main(String[] args) throws Exception {
        read();
    }
}
